package com.pennywise.controller;

import com.pennywise.common.response.Result;
import com.pennywise.model.Reminder;
import com.pennywise.service.ReminderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Tag(name = "提醒管理")
@RestController
@RequestMapping("/api/reminders")
@RequiredArgsConstructor
public class ReminderController {
    
    private final ReminderService reminderService;
    
    @Operation(summary = "添加提醒")
    @PostMapping
    public Result<Void> addReminder(@RequestBody Reminder reminder) {
        reminderService.addReminder(reminder);
        return Result.success(null);
    }
    
    @Operation(summary = "获取提醒")
    @GetMapping("/{id}")
    public Result<Reminder> getReminder(@PathVariable Long id) {
        return Result.success(reminderService.getReminder(id));
    }
    
    @Operation(summary = "更新提醒")
    @PutMapping("/{id}")
    public Result<Void> updateReminder(@PathVariable Long id, @RequestBody Reminder reminder) {
        reminder.setId(id);
        reminderService.updateReminder(reminder);
        return Result.success(null);
    }
    
    @Operation(summary = "删除提醒")
    @DeleteMapping("/{id}")
    public Result<Void> deleteReminder(@PathVariable Long id) {
        reminderService.deleteReminder(id);
        return Result.success(null);
    }
} 